package com.ruoyi.ruoyimaintenance.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.ruoyimaintenance.domain.entity.MaintenanceDL;
import com.ruoyi.ruoyimaintenance.domain.entity.MaintenanceDeviceConfig;
import com.ruoyi.ruoyimaintenance.domain.entity.MaintenanceLogdata;
import com.ruoyi.ruoyimaintenance.mapper.MaintenanceLogdataMapper;
import com.ruoyi.ruoyimaintenance.service.MaintenanceLogdataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MaintenanceLogdataServiceImpl implements MaintenanceLogdataService {

    @Autowired
    MaintenanceLogdataMapper maintenanceLogdataMapper;


    @Override
    public int addMaintenanceLogdata(MaintenanceDL maintenanceDL) {
        return maintenanceLogdataMapper.addMaintenanceLogdata(maintenanceDL);
    }

    @Override
    public PageInfo<MaintenanceLogdata> maintenanceLogdataBySearch(Integer pageNub, Integer pageSize, Integer line, String machineNumber, String headNumber,String timeStar,String timeEnd) {
        PageHelper.startPage(pageNub,pageSize);
        List<MaintenanceLogdata> maintenanceLogdata = maintenanceLogdataMapper.maintenanceLogdataBySearch(line,machineNumber,headNumber,timeStar,timeEnd);
        PageInfo<MaintenanceLogdata> pageInfo=new PageInfo<>(maintenanceLogdata);
        return pageInfo;
    }

    @Override
    public int deleteMaintenanceLogdata(Long id) {
        return maintenanceLogdataMapper.deleteMaintenanceLogdata(id);
    }

    @Override
    public PageInfo<MaintenanceDL> maintenanceDLBySearch(Integer pageNub, Integer pageSize, Integer line, String machineNumber, String headNumber) {
        PageHelper.startPage(pageNub,pageSize);
        List<MaintenanceDL> maintenanceDL = maintenanceLogdataMapper.maintenanceDLBySearch(line,machineNumber,headNumber);
        PageInfo<MaintenanceDL> pageInfo=new PageInfo<>(maintenanceDL);
        return pageInfo;
    }

    @Override
    public int updateMaintenanceLogdata(long id, String maintenanceDate, String headCount, String maintenanceItem, String maintenanceResult, String implementer, String abnormalDescription) {
        return maintenanceLogdataMapper.updateMaintenanceLogdata(id,maintenanceDate,headCount,maintenanceItem,maintenanceResult,implementer,abnormalDescription);
    }

    @Override
    public List<MaintenanceDL> queryMaintenanceDLList(Integer line, String machineNumber, String headNumber, String timeStar, String timeEnd) {
        return maintenanceLogdataMapper.queryMaintenanceDLList(line, machineNumber, headNumber, timeStar,timeEnd);
    }


}
